package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SetmealMapper {
    List<Long> byId(List<Long> ids);

    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @AutoFill(type = OperationType.INSERT)
    void save(Setmeal setmeal);
    @Select("select * from setmeal where id = #{id}")
    Setmeal setmealById(Long id);
    @Delete("delete from setmeal where id = #{id}")
    void delete(Long id);

    @AutoFill(type = OperationType.UPDATE)
    void update(Setmeal setmeal);

    @Select("select * from setmeal where category_id = #{categoryId} and status = #{status}")
    List<Setmeal> byCategory(Setmeal setmeal);

    @Select("select count(*) from setmeal where status = #{i}")
    int byStatus(int i);
}
